set SETUP_FILE=%~dp0%1
set OUT_PATH=%2
set SERVER_NAME=%3
set CURR_PATH =%~dp0

@echo off

cd %OUT_PATH%
del /Q /S /-H .\
python %SETUP_FILE% py2exe
xcopy /E /H /R /K /Y .\dist\*.* .\
rd   /Q /S .\build
rd   /Q /S .\dist

echo sc create %SERVER_NAME% binPath= "./%SERVER_NAME%.exe" > ./install_%SERVER_NAME%.bat
echo sc delete %SERVER_NAME% > ./uninstall_%SERVER_NAME%.bat

cd %CURR_PATH%

@Rem echo 当前盘符：%~d0
@Rem echo 当前盘符和路径：%~dp0
@Rem echo 当前批处理全路径：%~f0
@Rem echo 当前盘符和路径的短文件名格式：%~sdp0
@Rem echo 当前CMD默认目录：%cd%